<template>
 	<div class="table-wrapped">
 		<div class="table-top">
 			<div class="table-header">
 				<div>
 					<el-input v-model="account" class="w-50 m-2" size="large" placeholder="输入账号进行搜索"
 						:prefix-icon="Search" @change="searchLoginAccount()" clearable @clear="getLoginFirstPageList" />
 				</div>
 				<div class="upload-wrapped">
 					<el-button type="danger" @click="clearList">清空操作日志</el-button>
 				</div>
 			</div>
 			<div class="table-content">
 				<el-table :data='tableData' style="width: 100%;">
 					<el-table-column type="index" width="50"></el-table-column>
 					<el-table-column prop="account" label="账号" />
 					<el-table-column prop="name" label="名字" />
 					<el-table-column prop="email" label="联系方式">
 					</el-table-column>
 					<el-table-column prop="login_time" label="登录时间" width="200">
 						<template #default="{row}">
 							<div>{{row.login_time?.slice(0,16)}}</div>
 						</template>
 					</el-table-column>
 
 				</el-table>
 			</div>
 		</div>
 		<!-- <div class="table-footer">
 			<el-pagination :page-size="1" :current-page="paginationData.loginCurrentPage" :pager-count="7"
 				:total="paginationData.loginTotal" :page-count="paginationData.loginPageCount"
 				@current-change="loginCurrentChange" layout="prev, pager, next" />
 		</div> -->
 	</div>
</template>

<script setup lang="ts">
import {ref,onMounted} from 'vue'
import {Search} from '@element-plus/icons-vue'
import {loginLogList,clearLoginLogList} from '@/api/log/index'
const account = ref()
onMounted(()=>{
  getData()
})
const tableData = ref([])
const getData = async()=>{
  const res = await loginLogList()
  if(res.status == 0){
    tableData.value = res.data
  }
}
const searchLoginAccount = ()=>{}
const getLoginFirstPageList = ()=>{}
//清空操作日志
const clearList = async()=>{
  const res = await clearLoginLogList()
  if(res.status == 0){
    getData()
  }
}

const paginationData = {
  loginCurrentPage:1,
  loginTotal:0,
  loginPageCount:5,
}
const loginCurrentChange = ()=>{}

</script>

<style lang="scss" scoped>
@import url('@/assets//css/common.scss');

	:deep(.el-table .cell) {
		font-weight: 400;
	}

	a {
		color: #fff;
		display: block;
		text-decoration: none;
	}
</style>
